<template>
	<view class="top">
		<view class="back-btn" @click="backPage()">
			<view class="back-icon"></view>
		</view>
		<view style="color: white;text-align: center;">活动详情</view>
		<uni-card class="card">
			<view class="items2">
				<view class="items_left">
					标题：
				</view>
				<view class="items_right">
					<view>{{formData.title}}</view>
				</view>
			</view>
			<view class="items2">
				<view class="items_left">
					发布人：
				</view>
				<view class="items_right">
				<view>{{formMerchant.name}}</view>
				</view>
			</view>
			<view class="items2">
				<view class="items_left">
					发布时间：
				</view>
				<view class="items_right">
					<view>{{formData.time}}</view>
				</view>
			</view>
			<view class="items2">
				<view class="items_left">
					审核状态：
				</view>
				<view class="items_right">
					{{formData.shenheStatus}}
				</view>
			</view>
			<view class="items2">
				<view class="items_left">
					审核时间：
				</view>
				<view class="items_right">
					2023/03/10 15:09
				</view>
			</view>
			<view class="items2">
				<view class="items_left">
					审核说明：
				</view>
				<view class="items_right">

				</view>
			</view>


		</uni-card>
		<uni-card class="card">
			<view class="items2">
				<view class="items_left">
					发布内容：
				</view>
				<view class="items_right">
					{{formData.content}}
				</view>
			</view>
			<view class="items2">
				<view class="items_left">
					图片：
				</view>
				<view class="items_right">
					<image v-if="!edit && formData.img" 
								         :src="formData.img" 
								         mode="widthFix" 
								         style="width: 300rpx; border-radius: 10rpx;" />
				</view>
			</view>
		</uni-card>
	</view>
</template>

<script setup>
	import {onMounted, ref} from 'vue';
import request from '../../../util/request';
import baseUrl from '../../../util/urlConfig';
	import {onLoad} from '@dcloudio/uni-app'
	

	
	onLoad((options)=>{
		
		// 获取当前页面的参数（options 包含所有 URL 参数）
		// const options = uni.getLaunchOptionsSync().query; // 或使用 getCurrentPages() 获取当前页
		// console.log('000',options)
		let id = '';
		id = options.e;  //提取活动id
		console.log(id)
		showdetails(id);		
	})
	

	const formData = ref({})
	const formMerchant = ref({
		name:''
	})
	
	const showdetails = (id) =>{
		console.log("qingqiuzhiqiandayin"+id)
		request({
			url: baseUrl + '/ly/activities/activities/'+id,
			method: 'GET',
			success(res){
				console.log(res.data)
				console.log(formMerchant.value)
				formData.value= res.data.data
				formMerchant.value = res.data.data.merchant
			},
			fail(res){
				console.log("err")
			}
		});
	};
	function backPage() {
		uni.navigateBack()
	}
	
	
</script>

<style>
	@import url('@/common/app.css');

	.card {
		margin: 0;
		height: auto;
	}

	.items2 {
		display: flex;
		justify-content: space-between;
		align-items: start;
		margin-bottom: 40rpx;
	}

	.items_left {
		width: 25%;
		color: black;
	}

	.items_right {
		width: 75%;
		color: black;
	}

	.items_right image {
		width: 300rpx;
		height: 200rpx;
		border-radius: 10rpx;
	}

	.back-btn {
		margin-left: 20rpx;
		width: 50rpx;
		height: 50rpx;
		position: relative;
	}

	.back-icon {
		width: 30px;
		height: 30px;
	}

	.back-icon::before {
		content: "";
		position: absolute;
		width: 20px;
		height: 2px;
		background-color: #fff;
		top: 80rpx;
		left: 47rpx;
		transform: translate(-50%, -50%);
	}

	.back-icon::after {
		content: "";
		position: absolute;
		width: 10px;
		height: 10px;
		border-left: 2px solid #fff;
		border-bottom: 2px solid #fff;
		transform: rotate(45deg);
		top: 70rpx;
		left: 30rpx;
	}
</style>